<template>
  <div>
      <h1>我是详情页面----{{this.$route.params.xiaoming}}</h1>
      <button @click="fun()"> &lt; </button>


      <h1>{{content[0].title}}</h1>
        <p>{{content[0].content}}</p>
  </div>
</template>

<script>
export default {
    data(){
      return {
          content:[],
        arr:[
          {id:123434, title:"我是新闻标题11",content:"我是内容11"},
          {id:2435124, title:"我是新闻标题12",content:"我是内容12"},
          {id:3345345, title:"我是新闻标题13",content:"我是内容13"},
          {id:42346568, title:"我是新闻标题14",content:"我是内容14"},
          {id:557834524, title:"我是新闻标题15",content:"我是内容15"},
          {id:634623475, title:"我是新闻标题16",content:"我是内容16"},
          {id:7234468, title:"我是新闻标题17",content:"我是内容17"}
        ]
      }
    },
    created(){
       console.log(this.$route.params.xiaoming) 
      this.content= this.arr.filter((v)=>{
           if(v.id===this.$route.params.xiaoming){
               return v
           }
       })

       console.log(this.content)
    },
    methods:{
        fun(){
            this.$router.go(-1)
        }
    }
}
</script>

<style>

</style>